LinSpace
生成从 start 到 end 的等间距序列,线性插值
\[\text{output}_i = \text{start} + i \cdot \frac{\text{end} - \text{start}}{\text{length} - 1},\quad i = 0, 1, \dots, \text{length} - 1\]
- 输入:
start - 序列起始值。
end - 序列终止值(包含)。
length - 序列点数;要求 length ≥ 2。
core_mask(可选) - 核掩码(仅适用于共享存储版本)。
- 输出:
output - 输出序列地址(float32)。
- 支持平台:
FT78NEMT7004
备注
多核版本按行数均匀分割,各核处理自己的段落。
步长计算为 (end - start) / (length - 1)。
共享存储版本:
-
void fp_linspace_s(float *output, float start, float end, int length, int core_mask)
C调用示例:
1#include <stdio.h> 2 3int main(int argc, char* argv[]) { 4 float *output = (float *)0xA0000000; // DDR 5 float start = 0.0f; 6 float end = 100.0f; 7 int length = 1001; 8 int core_mask = 0xff; 9 fp_linspace_s(output, start, end, length, core_mask); 10 return 0; 11}
私有存储版本:
-
void fp_linspace_p(float *output, float start, float step, int num)
C调用示例:
1#include <stdio.h> 2 3int main(int argc, char* argv[]) { 4 float *output = (float *)0x10000000; // L2 5 float start = 1.5f; 6 float step = 0.5f; 7 int num = 1000; 8 fp_linspace_p(output, start, step, num); 9 return 0; 10}